import java.util.Arrays;

/**
 * 冒泡排序
 */
public class 冒泡排序 {

    public static void main(String[] args) {

        try{

            int[] nums = new int[]{64, 34, 25, 12, 22, 11, 90};

            doBubbleSort(nums);



        }catch(Exception e){
            e.printStackTrace();
        }

    }

    private static void doBubbleSort(int[] nums){

        for(int i=0; i<nums.length-1; i++){
            for(int j=0; j<nums.length-1-i; j++){

                if(nums[j] > nums[j+1]){

                    //交换
                    int temp = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1] = temp;

                }

            }
        }

        //int 数组 转 string 数组
        Arrays.stream(nums).boxed().map(s -> s+",").forEach(System.out::print);

        System.out.println();

    }
}